<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>digichef.registration.models</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="digichef-module.html">Package&nbsp;digichef</a> ::
        <a href="digichef.registration-module.html">Package&nbsp;registration</a> ::
        Module&nbsp;models
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="digichef.registration.models-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="digichef.registration.models-module.html">Module digichef.registration.models</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">datetime</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">random</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Module re=re-module.html"><a title="re" class="py-name" href="#" onclick="return doclink('link-0', 're', 'link-0');">re</a></tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sha</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">django</tt><tt class="py-op">.</tt><tt class="py-name">conf</tt> <tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Module digichef.settings=digichef.settings-module.html,Module digichef.tagging.settings=digichef.tagging.settings-module.html,Module digichef.tagging.tests.settings=digichef.tagging.tests.settings-module.html,Module digichef.voting.tests.settings=digichef.voting.tests.settings-module.html"><a title="digichef.settings
digichef.tagging.settings
digichef.tagging.tests.settings
digichef.voting.tests.settings" class="py-name" href="#" onclick="return doclink('link-1', 'settings', 'link-1');">settings</a></tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">django</tt><tt class="py-op">.</tt><tt class="py-name">db</tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Module digichef.core.models=digichef.core.models-module.html,Module digichef.profiles.models=digichef.profiles.models-module.html,Module digichef.recipes.models=digichef.recipes.models-module.html,Module digichef.recommender.models=digichef.recommender.models-module.html,Module digichef.registration.models=digichef.registration.models-module.html,Module digichef.tagging.models=digichef.tagging.models-module.html,Module digichef.tagging.tests.models=digichef.tagging.tests.models-module.html,Module digichef.util.models=digichef.util.models-module.html,Module digichef.voting.models=digichef.voting.models-module.html,Module digichef.voting.tests.models=digichef.voting.tests.models-module.html"><a title="digichef.core.models
digichef.profiles.models
digichef.recipes.models
digichef.recommender.models
digichef.registration.models
digichef.tagging.models
digichef.tagging.tests.models
digichef.util.models
digichef.voting.models
digichef.voting.tests.models" class="py-name" href="#" onclick="return doclink('link-2', 'models', 'link-2');">models</a></tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">django</tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Function re.template()=re-module.html#template"><a title="re.template" class="py-name" href="#" onclick="return doclink('link-3', 'template', 'link-3');">template</a></tt><tt class="py-op">.</tt><tt class="py-name">loader</tt> <tt class="py-keyword">import</tt> <tt class="py-name">render_to_string</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">django</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Module digichef.profiles.utils=digichef.profiles.utils-module.html,Module digichef.recommender.utils=digichef.recommender.utils-module.html,Module digichef.tagging.utils=digichef.tagging.utils-module.html"><a title="digichef.profiles.utils
digichef.recommender.utils
digichef.tagging.utils" class="py-name" href="#" onclick="return doclink('link-4', 'utils', 'link-4');">utils</a></tt><tt class="py-op">.</tt><tt class="py-name">translation</tt> <tt class="py-keyword">import</tt> <tt class="py-name">ugettext_lazy</tt> <tt class="py-keyword">as</tt> <tt class="py-name">_</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">django</tt><tt class="py-op">.</tt><tt class="py-name">contrib</tt><tt class="py-op">.</tt><tt class="py-name">auth</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name"><a title="digichef.core.models
digichef.profiles.models
digichef.recipes.models
digichef.recommender.models
digichef.registration.models
digichef.tagging.models
digichef.tagging.tests.models
digichef.util.models
digichef.voting.models
digichef.voting.tests.models" class="py-name" href="#" onclick="return doclink('link-5', 'models', 'link-2');">models</a></tt> <tt class="py-keyword">import</tt> <tt class="py-name">User</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">django</tt><tt class="py-op">.</tt><tt class="py-name">contrib</tt><tt class="py-op">.</tt><tt class="py-name">sites</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name"><a title="digichef.core.models
digichef.profiles.models
digichef.recipes.models
digichef.recommender.models
digichef.registration.models
digichef.tagging.models
digichef.tagging.tests.models
digichef.util.models
digichef.voting.models
digichef.voting.tests.models" class="py-name" href="#" onclick="return doclink('link-6', 'models', 'link-2');">models</a></tt> <tt class="py-keyword">import</tt> <tt class="py-name">Site</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt id="link-7" class="py-name" targets="Variable digichef.registration.models.SHA1_RE=digichef.registration.models-module.html#SHA1_RE"><a title="digichef.registration.models.SHA1_RE" class="py-name" href="#" onclick="return doclink('link-7', 'SHA1_RE', 'link-7');">SHA1_RE</a></tt> <tt class="py-op">=</tt> <tt id="link-8" class="py-name"><a title="re" class="py-name" href="#" onclick="return doclink('link-8', 're', 'link-0');">re</a></tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Function re.compile()=re-module.html#compile"><a title="re.compile" class="py-name" href="#" onclick="return doclink('link-9', 'compile', 'link-9');">compile</a></tt><tt class="py-op">(</tt><tt class="py-string">'^[a-f0-9]{40}$'</tt><tt class="py-op">)</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"> </tt>
<a name="RegistrationManager"></a><div id="RegistrationManager-def"><a name="L17"></a><tt class="py-lineno"> 17</tt> <a class="py-toggle" href="#" id="RegistrationManager-toggle" onclick="return toggle('RegistrationManager');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationManager-class.html">RegistrationManager</a><tt class="py-op">(</tt><tt class="py-base-class">models</tt><tt class="py-op">.</tt><tt class="py-base-class">Manager</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationManager-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="RegistrationManager-expanded"><a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">    Custom manager for the ``RegistrationProfile`` model.</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">    The methods defined here provide shortcuts for account creation</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">    and activation (including generation and emailing of activation</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">    keys), and for cleaning out expired inactive accounts.</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="RegistrationManager.activate_user"></a><div id="RegistrationManager.activate_user-def"><a name="L26"></a><tt class="py-lineno"> 26</tt> <a class="py-toggle" href="#" id="RegistrationManager.activate_user-toggle" onclick="return toggle('RegistrationManager.activate_user');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationManager-class.html#activate_user">activate_user</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">activation_key</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationManager.activate_user-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="RegistrationManager.activate_user-expanded"><a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">        Validate an activation key and activate the corresponding</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">        ``User`` if valid.</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">        If the key is valid and has not expired, return the ``User``</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring">        after activating.</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-docstring">        If the key is not valid or has expired, return ``False``.</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-docstring">        If the key is valid but the ``User`` is already active,</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-docstring">        return ``False``.</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring">        To prevent reactivation of an account which has been</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">        deactivated by site administrators, the activation key is</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">        reset to the string ``ALREADY_ACTIVATED`` after successful</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">        activation.</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-comment"># Make sure the key we're trying conforms to the pattern of a</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">        <tt class="py-comment"># SHA1 hash; if it doesn't, no point trying to look it up in</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">        <tt class="py-comment"># the database.</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-10" class="py-name"><a title="digichef.registration.models.SHA1_RE" class="py-name" href="#" onclick="return doclink('link-10', 'SHA1_RE', 'link-7');">SHA1_RE</a></tt><tt class="py-op">.</tt><tt id="link-11" class="py-name" targets="Function re.search()=re-module.html#search"><a title="re.search" class="py-name" href="#" onclick="return doclink('link-11', 'search', 'link-11');">search</a></tt><tt class="py-op">(</tt><tt id="link-12" class="py-name" targets="Variable digichef.registration.models.RegistrationProfile.activation_key=digichef.registration.models.RegistrationProfile-class.html#activation_key"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-12', 'activation_key', 'link-12');">activation_key</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">                <tt class="py-name">profile</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-13" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-13', 'activation_key', 'link-12');">activation_key</a></tt><tt class="py-op">=</tt><tt id="link-14" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-14', 'activation_key', 'link-12');">activation_key</a></tt><tt class="py-op">)</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Variable digichef.profiles.forms.ProfileForm.Meta.model=digichef.profiles.forms.ProfileForm.Meta-class.html#model,Variable digichef.tagging.forms.TagAdminForm.Meta.model=digichef.tagging.forms.TagAdminForm.Meta-class.html#model"><a title="digichef.profiles.forms.ProfileForm.Meta.model
digichef.tagging.forms.TagAdminForm.Meta.model" class="py-name" href="#" onclick="return doclink('link-15', 'model', 'link-15');">model</a></tt><tt class="py-op">.</tt><tt class="py-name">DoesNotExist</tt><tt class="py-op">:</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">profile</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Method digichef.registration.models.RegistrationProfile.activation_key_expired()=digichef.registration.models.RegistrationProfile-class.html#activation_key_expired"><a title="digichef.registration.models.RegistrationProfile.activation_key_expired" class="py-name" href="#" onclick="return doclink('link-16', 'activation_key_expired', 'link-16');">activation_key_expired</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">                <tt id="link-17" class="py-name" targets="Variable digichef.profiles.models.Profile.user=digichef.profiles.models.Profile-class.html#user,Variable digichef.registration.models.RegistrationProfile.user=digichef.registration.models.RegistrationProfile-class.html#user,Variable digichef.util.models.UserMeta.user=digichef.util.models.UserMeta-class.html#user,Variable digichef.voting.models.Vote.user=digichef.voting.models.Vote-class.html#user"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-17', 'user', 'link-17');">user</a></tt> <tt class="py-op">=</tt> <tt class="py-name">profile</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-18', 'user', 'link-17');">user</a></tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">                <tt id="link-19" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-19', 'user', 'link-17');">user</a></tt><tt class="py-op">.</tt><tt class="py-name">is_active</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">                <tt id="link-20" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-20', 'user', 'link-17');">user</a></tt><tt class="py-op">.</tt><tt id="link-21" class="py-name" targets="Method digichef.profiles.forms.ProfileForm.save()=digichef.profiles.forms.ProfileForm-class.html#save,Method digichef.registration.forms.RegistrationForm.save()=digichef.registration.forms.RegistrationForm-class.html#save"><a title="digichef.profiles.forms.ProfileForm.save
digichef.registration.forms.RegistrationForm.save" class="py-name" href="#" onclick="return doclink('link-21', 'save', 'link-21');">save</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">                <tt class="py-name">profile</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-22', 'activation_key', 'link-12');">activation_key</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="digichef.profiles.forms.ProfileForm.Meta.model
digichef.tagging.forms.TagAdminForm.Meta.model" class="py-name" href="#" onclick="return doclink('link-23', 'model', 'link-15');">model</a></tt><tt class="py-op">.</tt><tt id="link-24" class="py-name" targets="Variable digichef.registration.models.RegistrationProfile.ACTIVATED=digichef.registration.models.RegistrationProfile-class.html#ACTIVATED"><a title="digichef.registration.models.RegistrationProfile.ACTIVATED" class="py-name" href="#" onclick="return doclink('link-24', 'ACTIVATED', 'link-24');">ACTIVATED</a></tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">                <tt class="py-name">profile</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="digichef.profiles.forms.ProfileForm.save
digichef.registration.forms.RegistrationForm.save" class="py-name" href="#" onclick="return doclink('link-25', 'save', 'link-21');">save</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt id="link-26" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-26', 'user', 'link-17');">user</a></tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
</div><a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">     </tt>
<a name="RegistrationManager.create_inactive_user"></a><div id="RegistrationManager.create_inactive_user-def"><a name="L62"></a><tt class="py-lineno"> 62</tt> <a class="py-toggle" href="#" id="RegistrationManager.create_inactive_user-toggle" onclick="return toggle('RegistrationManager.create_inactive_user');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationManager-class.html#create_inactive_user">create_inactive_user</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">username</tt><tt class="py-op">,</tt> <tt class="py-param">password</tt><tt class="py-op">,</tt> <tt class="py-param">email</tt><tt class="py-op">,</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">                             <tt class="py-param">send_email</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-param">profile_callback</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationManager.create_inactive_user-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="RegistrationManager.create_inactive_user-expanded"><a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-docstring">        Create a new, inactive ``User``, generates a</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-docstring">        ``RegistrationProfile`` and email its activation key to the</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-docstring">        ``User``, returning the new ``User``.</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt class="py-docstring">        To disable the email, call with ``send_email=False``.</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt class="py-docstring">        The activation email will make use of two templates:</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-docstring">        ``registration/activation_email_subject.txt``</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-docstring">            This template will be used for the subject line of the</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-docstring">            email. It receives one context variable, ``site``, which</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt class="py-docstring">            is the currently-active</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt class="py-docstring">            ``django.contrib.sites.models.Site`` instance. Because it</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt class="py-docstring">            is used as the subject line of an email, this template's</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"><tt class="py-docstring">            output **must** be only a single line of text; output</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt class="py-docstring">            longer than one line will be forcibly joined into only a</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line"><tt class="py-docstring">            single line.</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"><tt class="py-docstring">        ``registration/activation_email.txt``</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line"><tt class="py-docstring">            This template will be used for the body of the email. It</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line"><tt class="py-docstring">            will receive three context variables: ``activation_key``</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line"><tt class="py-docstring">            will be the user's activation key (for use in constructing</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"><tt class="py-docstring">            a URL to activate the account), ``expiration_days`` will</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line"><tt class="py-docstring">            be the number of days for which the key will be valid and</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"><tt class="py-docstring">            ``site`` will be the currently-active</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"><tt class="py-docstring">            ``django.contrib.sites.models.Site`` instance.</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line"><tt class="py-docstring">        To enable creation of a custom user profile along with the</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line"><tt class="py-docstring">        ``User`` (e.g., the model specified in the</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-docstring">        ``AUTH_PROFILE_MODULE`` setting), define a function which</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line"><tt class="py-docstring">        knows how to create and save an instance of that model with</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"><tt class="py-docstring">        appropriate default values, and pass it as the keyword</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line"><tt class="py-docstring">        argument ``profile_callback``. This function should accept one</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line"><tt class="py-docstring">        keyword argument:</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"><tt class="py-docstring">        ``user``</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line"><tt class="py-docstring">            The ``User`` to relate the profile to.</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">        <tt class="py-name">new_user</tt> <tt class="py-op">=</tt> <tt class="py-name">User</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Variable digichef.recommender.models.Recommender.objects=digichef.recommender.models.Recommender-class.html#objects,Variable digichef.registration.models.RegistrationProfile.objects=digichef.registration.models.RegistrationProfile-class.html#objects,Variable digichef.tagging.models.Tag.objects=digichef.tagging.models.Tag-class.html#objects,Variable digichef.tagging.models.TaggedItem.objects=digichef.tagging.models.TaggedItem-class.html#objects,Variable digichef.voting.models.Vote.objects=digichef.voting.models.Vote-class.html#objects"><a title="digichef.recommender.models.Recommender.objects
digichef.registration.models.RegistrationProfile.objects
digichef.tagging.models.Tag.objects
digichef.tagging.models.TaggedItem.objects
digichef.voting.models.Vote.objects" class="py-name" href="#" onclick="return doclink('link-27', 'objects', 'link-27');">objects</a></tt><tt class="py-op">.</tt><tt class="py-name">create_user</tt><tt class="py-op">(</tt><tt id="link-28" class="py-name" targets="Variable digichef.registration.forms.RegistrationForm.username=digichef.registration.forms.RegistrationForm-class.html#username"><a title="digichef.registration.forms.RegistrationForm.username" class="py-name" href="#" onclick="return doclink('link-28', 'username', 'link-28');">username</a></tt><tt class="py-op">,</tt> <tt id="link-29" class="py-name" targets="Variable digichef.profiles.forms.ProfileForm.email=digichef.profiles.forms.ProfileForm-class.html#email,Variable digichef.registration.forms.RegistrationForm.email=digichef.registration.forms.RegistrationForm-class.html#email"><a title="digichef.profiles.forms.ProfileForm.email
digichef.registration.forms.RegistrationForm.email" class="py-name" href="#" onclick="return doclink('link-29', 'email', 'link-29');">email</a></tt><tt class="py-op">,</tt> <tt class="py-name">password</tt><tt class="py-op">)</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">        <tt class="py-name">new_user</tt><tt class="py-op">.</tt><tt class="py-name">is_active</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">        <tt class="py-name">new_user</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="digichef.profiles.forms.ProfileForm.save
digichef.registration.forms.RegistrationForm.save" class="py-name" href="#" onclick="return doclink('link-30', 'save', 'link-21');">save</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">         </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-name">registration_profile</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-31" class="py-name" targets="Function digichef.profiles.views.create_profile()=digichef.profiles.views-module.html#create_profile,Method digichef.registration.models.RegistrationManager.create_profile()=digichef.registration.models.RegistrationManager-class.html#create_profile"><a title="digichef.profiles.views.create_profile
digichef.registration.models.RegistrationManager.create_profile" class="py-name" href="#" onclick="return doclink('link-31', 'create_profile', 'link-31');">create_profile</a></tt><tt class="py-op">(</tt><tt class="py-name">new_user</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">         </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">profile_callback</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">            <tt class="py-name">profile_callback</tt><tt class="py-op">(</tt><tt id="link-32" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-32', 'user', 'link-17');">user</a></tt><tt class="py-op">=</tt><tt class="py-name">new_user</tt><tt class="py-op">)</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">         </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">send_email</tt><tt class="py-op">:</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">            <tt class="py-keyword">from</tt> <tt class="py-name">django</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name" targets="Package digichef.core=digichef.core-module.html"><a title="digichef.core" class="py-name" href="#" onclick="return doclink('link-33', 'core', 'link-33');">core</a></tt><tt class="py-op">.</tt><tt class="py-name">mail</tt> <tt class="py-keyword">import</tt> <tt class="py-name">send_mail</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">            <tt class="py-name">current_site</tt> <tt class="py-op">=</tt> <tt class="py-name">Site</tt><tt class="py-op">.</tt><tt id="link-34" class="py-name"><a title="digichef.recommender.models.Recommender.objects
digichef.registration.models.RegistrationProfile.objects
digichef.tagging.models.Tag.objects
digichef.tagging.models.TaggedItem.objects
digichef.voting.models.Vote.objects" class="py-name" href="#" onclick="return doclink('link-34', 'objects', 'link-27');">objects</a></tt><tt class="py-op">.</tt><tt class="py-name">get_current</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">             </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">            <tt class="py-name">subject</tt> <tt class="py-op">=</tt> <tt class="py-name">render_to_string</tt><tt class="py-op">(</tt><tt class="py-string">'registration/activation_email_subject.txt'</tt><tt class="py-op">,</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">                                       <tt class="py-op">{</tt> <tt class="py-string">'site'</tt><tt class="py-op">:</tt> <tt class="py-name">current_site</tt> <tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">            <tt class="py-comment"># Email subject *must not* contain newlines</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">            <tt class="py-name">subject</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">subject</tt><tt class="py-op">.</tt><tt class="py-name">splitlines</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">             </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">            <tt class="py-name">message</tt> <tt class="py-op">=</tt> <tt class="py-name">render_to_string</tt><tt class="py-op">(</tt><tt class="py-string">'registration/activation_email.txt'</tt><tt class="py-op">,</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">                                       <tt class="py-op">{</tt> <tt class="py-string">'activation_key'</tt><tt class="py-op">:</tt> <tt class="py-name">registration_profile</tt><tt class="py-op">.</tt><tt id="link-35" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-35', 'activation_key', 'link-12');">activation_key</a></tt><tt class="py-op">,</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">                                         <tt class="py-string">'expiration_days'</tt><tt class="py-op">:</tt> <tt id="link-36" class="py-name"><a title="digichef.settings
digichef.tagging.settings
digichef.tagging.tests.settings
digichef.voting.tests.settings" class="py-name" href="#" onclick="return doclink('link-36', 'settings', 'link-1');">settings</a></tt><tt class="py-op">.</tt><tt class="py-name">ACCOUNT_ACTIVATION_DAYS</tt><tt class="py-op">,</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">                                         <tt class="py-string">'site'</tt><tt class="py-op">:</tt> <tt class="py-name">current_site</tt> <tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">             </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">            <tt class="py-name">send_mail</tt><tt class="py-op">(</tt><tt class="py-name">subject</tt><tt class="py-op">,</tt> <tt class="py-name">message</tt><tt class="py-op">,</tt> <tt id="link-37" class="py-name"><a title="digichef.settings
digichef.tagging.settings
digichef.tagging.tests.settings
digichef.voting.tests.settings" class="py-name" href="#" onclick="return doclink('link-37', 'settings', 'link-1');">settings</a></tt><tt class="py-op">.</tt><tt class="py-name">DEFAULT_FROM_EMAIL</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-name">new_user</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="digichef.profiles.forms.ProfileForm.email
digichef.registration.forms.RegistrationForm.email" class="py-name" href="#" onclick="return doclink('link-38', 'email', 'link-29');">email</a></tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">new_user</tt> </tt>
</div><a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">     </tt>
<a name="RegistrationManager.create_profile"></a><div id="RegistrationManager.create_profile-def"><a name="L130"></a><tt class="py-lineno">130</tt> <a class="py-toggle" href="#" id="RegistrationManager.create_profile-toggle" onclick="return toggle('RegistrationManager.create_profile');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationManager-class.html#create_profile">create_profile</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">user</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationManager.create_profile-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="RegistrationManager.create_profile-expanded"><a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line"><tt class="py-docstring">        Create a ``RegistrationProfile`` for a given</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line"><tt class="py-docstring">        ``User``, and return the ``RegistrationProfile``.</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line"><tt class="py-docstring">        The activation key for the ``RegistrationProfile`` will be a</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line"><tt class="py-docstring">        SHA1 hash, generated from a combination of the ``User``'s</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line"><tt class="py-docstring">        username and a random salt.</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">        <tt class="py-name">salt</tt> <tt class="py-op">=</tt> <tt class="py-name">sha</tt><tt class="py-op">.</tt><tt class="py-name">new</tt><tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">random</tt><tt class="py-op">.</tt><tt class="py-name">random</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">hexdigest</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-number">5</tt><tt class="py-op">]</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">        <tt id="link-39" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-39', 'activation_key', 'link-12');">activation_key</a></tt> <tt class="py-op">=</tt> <tt class="py-name">sha</tt><tt class="py-op">.</tt><tt class="py-name">new</tt><tt class="py-op">(</tt><tt class="py-name">salt</tt><tt class="py-op">+</tt><tt id="link-40" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-40', 'user', 'link-17');">user</a></tt><tt class="py-op">.</tt><tt id="link-41" class="py-name"><a title="digichef.registration.forms.RegistrationForm.username" class="py-name" href="#" onclick="return doclink('link-41', 'username', 'link-28');">username</a></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">hexdigest</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">create</tt><tt class="py-op">(</tt><tt id="link-42" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-42', 'user', 'link-17');">user</a></tt><tt class="py-op">=</tt><tt id="link-43" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-43', 'user', 'link-17');">user</a></tt><tt class="py-op">,</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">                           <tt id="link-44" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-44', 'activation_key', 'link-12');">activation_key</a></tt><tt class="py-op">=</tt><tt id="link-45" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-45', 'activation_key', 'link-12');">activation_key</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">         </tt>
<a name="RegistrationManager.delete_expired_users"></a><div id="RegistrationManager.delete_expired_users-def"><a name="L145"></a><tt class="py-lineno">145</tt> <a class="py-toggle" href="#" id="RegistrationManager.delete_expired_users-toggle" onclick="return toggle('RegistrationManager.delete_expired_users');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationManager-class.html#delete_expired_users">delete_expired_users</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationManager.delete_expired_users-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="RegistrationManager.delete_expired_users-expanded"><a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line"><tt class="py-docstring">        Remove expired instances of ``RegistrationProfile`` and their</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line"><tt class="py-docstring">        associated ``User``s.</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-docstring">        Accounts to be deleted are identified by searching for</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line"><tt class="py-docstring">        instances of ``RegistrationProfile`` with expired activation</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line"><tt class="py-docstring">        keys, and then checking to see if their associated ``User``</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line"><tt class="py-docstring">        instances have the field ``is_active`` set to ``False``; any</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line"><tt class="py-docstring">        ``User`` who is both inactive and has an expired activation</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line"><tt class="py-docstring">        key will be deleted.</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line"><tt class="py-docstring">        It is recommended that this method be executed regularly as</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line"><tt class="py-docstring">        part of your routine site maintenance; this application</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line"><tt class="py-docstring">        provides a custom management command which will call this</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line"><tt class="py-docstring">        method, accessible as ``manage.py cleanupregistration``.</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line"><tt class="py-docstring">        Regularly clearing out accounts which have never been</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line"><tt class="py-docstring">        activated serves two useful purposes:</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line"><tt class="py-docstring">        1. It alleviates the ocasional need to reset a</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line"><tt class="py-docstring">           ``RegistrationProfile`` and/or re-send an activation email</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line"><tt class="py-docstring">           when a user does not receive or does not act upon the</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line"><tt class="py-docstring">           initial activation email; since the account will be</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line"><tt class="py-docstring">           deleted, the user will be able to simply re-register and</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line"><tt class="py-docstring">           receive a new activation key.</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line"><tt class="py-docstring">        2. It prevents the possibility of a malicious user registering</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line"><tt class="py-docstring">           one or more accounts and never activating them (thus</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line"><tt class="py-docstring">           denying the use of those usernames to anyone else); since</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line"><tt class="py-docstring">           those accounts will be deleted, the usernames will become</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line"><tt class="py-docstring">           available for use again.</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line"><tt class="py-docstring">        If you have a troublesome ``User`` and wish to disable their</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line"><tt class="py-docstring">        account while keeping it in the database, simply delete the</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line"><tt class="py-docstring">        associated ``RegistrationProfile``; an inactive ``User`` which</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line"><tt class="py-docstring">        does not have an associated ``RegistrationProfile`` will not</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line"><tt class="py-docstring">        be deleted.</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">profile</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">all</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">profile</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key_expired" class="py-name" href="#" onclick="return doclink('link-46', 'activation_key_expired', 'link-16');">activation_key_expired</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">                <tt id="link-47" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-47', 'user', 'link-17');">user</a></tt> <tt class="py-op">=</tt> <tt class="py-name">profile</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-48', 'user', 'link-17');">user</a></tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-49" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-49', 'user', 'link-17');">user</a></tt><tt class="py-op">.</tt><tt class="py-name">is_active</tt><tt class="py-op">:</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">                    <tt id="link-50" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-50', 'user', 'link-17');">user</a></tt><tt class="py-op">.</tt><tt class="py-name">delete</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line"> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line"> </tt>
<a name="RegistrationProfile"></a><div id="RegistrationProfile-def"><a name="L192"></a><tt class="py-lineno">192</tt> <a class="py-toggle" href="#" id="RegistrationProfile-toggle" onclick="return toggle('RegistrationProfile');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationProfile-class.html">RegistrationProfile</a><tt class="py-op">(</tt><tt class="py-base-class">models</tt><tt class="py-op">.</tt><tt class="py-base-class">Model</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationProfile-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="RegistrationProfile-expanded"><a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line"><tt class="py-docstring">    A simple profile which stores an activation key for use during</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line"><tt class="py-docstring">    user account registration.</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line"><tt class="py-docstring">    Generally, you will not want to interact directly with instances</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line"><tt class="py-docstring">    of this model; the provided manager includes methods</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line"><tt class="py-docstring">    for creating and activating new accounts, as well as for cleaning</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line"><tt class="py-docstring">    out accounts which have never been activated.</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line"><tt class="py-docstring">    While it is possible to use this model as the value of the</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line"><tt class="py-docstring">    ``AUTH_PROFILE_MODULE`` setting, it's not recommended that you do</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"><tt class="py-docstring">    so. This model's sole purpose is to store data temporarily during</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line"><tt class="py-docstring">    account registration and activation, and a mechanism for</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line"><tt class="py-docstring">    automatically creating an instance of a site-specific profile</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line"><tt class="py-docstring">    model is provided via the ``create_inactive_user`` on</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line"><tt class="py-docstring">    ``RegistrationManager``.</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">    <tt id="link-51" class="py-name"><a title="digichef.registration.models.RegistrationProfile.ACTIVATED" class="py-name" href="#" onclick="return doclink('link-51', 'ACTIVATED', 'link-24');">ACTIVATED</a></tt> <tt class="py-op">=</tt> <tt class="py-string">u"ALREADY_ACTIVATED"</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">     </tt>
<a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line">    <tt id="link-52" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-52', 'user', 'link-17');">user</a></tt> <tt class="py-op">=</tt> <tt id="link-53" class="py-name"><a title="digichef.core.models
digichef.profiles.models
digichef.recipes.models
digichef.recommender.models
digichef.registration.models
digichef.tagging.models
digichef.tagging.tests.models
digichef.util.models
digichef.voting.models
digichef.voting.tests.models" class="py-name" href="#" onclick="return doclink('link-53', 'models', 'link-2');">models</a></tt><tt class="py-op">.</tt><tt class="py-name">ForeignKey</tt><tt class="py-op">(</tt><tt class="py-name">User</tt><tt class="py-op">,</tt> <tt class="py-name">unique</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt id="link-54" class="py-name" targets="Variable digichef.registration.models.RegistrationProfile.Meta.verbose_name=digichef.registration.models.RegistrationProfile.Meta-class.html#verbose_name,Variable digichef.tagging.models.Tag.Meta.verbose_name=digichef.tagging.models.Tag.Meta-class.html#verbose_name,Variable digichef.tagging.models.TaggedItem.Meta.verbose_name=digichef.tagging.models.TaggedItem.Meta-class.html#verbose_name"><a title="digichef.registration.models.RegistrationProfile.Meta.verbose_name
digichef.tagging.models.Tag.Meta.verbose_name
digichef.tagging.models.TaggedItem.Meta.verbose_name" class="py-name" href="#" onclick="return doclink('link-54', 'verbose_name', 'link-54');">verbose_name</a></tt><tt class="py-op">=</tt><tt class="py-name">_</tt><tt class="py-op">(</tt><tt class="py-string">'user'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line">    <tt id="link-55" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-55', 'activation_key', 'link-12');">activation_key</a></tt> <tt class="py-op">=</tt> <tt id="link-56" class="py-name"><a title="digichef.core.models
digichef.profiles.models
digichef.recipes.models
digichef.recommender.models
digichef.registration.models
digichef.tagging.models
digichef.tagging.tests.models
digichef.util.models
digichef.voting.models
digichef.voting.tests.models" class="py-name" href="#" onclick="return doclink('link-56', 'models', 'link-2');">models</a></tt><tt class="py-op">.</tt><tt class="py-name">CharField</tt><tt class="py-op">(</tt><tt class="py-name">_</tt><tt class="py-op">(</tt><tt class="py-string">'activation key'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">max_length</tt><tt class="py-op">=</tt><tt class="py-number">40</tt><tt class="py-op">)</tt> </tt>
<a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line">     </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line">    <tt id="link-57" class="py-name"><a title="digichef.recommender.models.Recommender.objects
digichef.registration.models.RegistrationProfile.objects
digichef.tagging.models.Tag.objects
digichef.tagging.models.TaggedItem.objects
digichef.voting.models.Vote.objects" class="py-name" href="#" onclick="return doclink('link-57', 'objects', 'link-27');">objects</a></tt> <tt class="py-op">=</tt> <tt id="link-58" class="py-name" targets="Class digichef.registration.models.RegistrationManager=digichef.registration.models.RegistrationManager-class.html"><a title="digichef.registration.models.RegistrationManager" class="py-name" href="#" onclick="return doclink('link-58', 'RegistrationManager', 'link-58');">RegistrationManager</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line">     </tt>
<a name="RegistrationProfile.Meta"></a><div id="RegistrationProfile.Meta-def"><a name="L218"></a><tt class="py-lineno">218</tt> <a class="py-toggle" href="#" id="RegistrationProfile.Meta-toggle" onclick="return toggle('RegistrationProfile.Meta');">-</a><tt class="py-line">    <tt class="py-keyword">class</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationProfile.Meta-class.html">Meta</a><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationProfile.Meta-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="RegistrationProfile.Meta-expanded"><a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line">        <tt id="link-59" class="py-name"><a title="digichef.registration.models.RegistrationProfile.Meta.verbose_name
digichef.tagging.models.Tag.Meta.verbose_name
digichef.tagging.models.TaggedItem.Meta.verbose_name" class="py-name" href="#" onclick="return doclink('link-59', 'verbose_name', 'link-54');">verbose_name</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_</tt><tt class="py-op">(</tt><tt class="py-string">'registration profile'</tt><tt class="py-op">)</tt> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line">        <tt id="link-60" class="py-name" targets="Variable digichef.registration.models.RegistrationProfile.Meta.verbose_name_plural=digichef.registration.models.RegistrationProfile.Meta-class.html#verbose_name_plural,Variable digichef.tagging.models.Tag.Meta.verbose_name_plural=digichef.tagging.models.Tag.Meta-class.html#verbose_name_plural,Variable digichef.tagging.models.TaggedItem.Meta.verbose_name_plural=digichef.tagging.models.TaggedItem.Meta-class.html#verbose_name_plural"><a title="digichef.registration.models.RegistrationProfile.Meta.verbose_name_plural
digichef.tagging.models.Tag.Meta.verbose_name_plural
digichef.tagging.models.TaggedItem.Meta.verbose_name_plural" class="py-name" href="#" onclick="return doclink('link-60', 'verbose_name_plural', 'link-60');">verbose_name_plural</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_</tt><tt class="py-op">(</tt><tt class="py-string">'registration profiles'</tt><tt class="py-op">)</tt> </tt>
</div><a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line">     </tt>
<a name="RegistrationProfile.__unicode__"></a><div id="RegistrationProfile.__unicode__-def"><a name="L222"></a><tt class="py-lineno">222</tt> <a class="py-toggle" href="#" id="RegistrationProfile.__unicode__-toggle" onclick="return toggle('RegistrationProfile.__unicode__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationProfile-class.html#__unicode__">__unicode__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationProfile.__unicode__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="RegistrationProfile.__unicode__-expanded"><a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-string">u"Registration information for %s"</tt> <tt class="py-op">%</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-61" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-61', 'user', 'link-17');">user</a></tt> </tt>
</div><a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line">     </tt>
<a name="RegistrationProfile.activation_key_expired"></a><div id="RegistrationProfile.activation_key_expired-def"><a name="L225"></a><tt class="py-lineno">225</tt> <a class="py-toggle" href="#" id="RegistrationProfile.activation_key_expired-toggle" onclick="return toggle('RegistrationProfile.activation_key_expired');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="digichef.registration.models.RegistrationProfile-class.html#activation_key_expired">activation_key_expired</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RegistrationProfile.activation_key_expired-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="RegistrationProfile.activation_key_expired-expanded"><a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line"><tt class="py-docstring">        Determine whether this ``RegistrationProfile``'s activation</tt> </tt>
<a name="L228"></a><tt class="py-lineno">228</tt>  <tt class="py-line"><tt class="py-docstring">        key has expired, returning a boolean -- ``True`` if the key</tt> </tt>
<a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line"><tt class="py-docstring">        has expired.</tt> </tt>
<a name="L230"></a><tt class="py-lineno">230</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line"><tt class="py-docstring">        Key expiration is determined by a two-step process:</tt> </tt>
<a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L233"></a><tt class="py-lineno">233</tt>  <tt class="py-line"><tt class="py-docstring">        1. If the user has already activated, the key will have been</tt> </tt>
<a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line"><tt class="py-docstring">           reset to the string ``ALREADY_ACTIVATED``. Re-activating is</tt> </tt>
<a name="L235"></a><tt class="py-lineno">235</tt>  <tt class="py-line"><tt class="py-docstring">           not permitted, and so this method returns ``True`` in this</tt> </tt>
<a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line"><tt class="py-docstring">           case.</tt> </tt>
<a name="L237"></a><tt class="py-lineno">237</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L238"></a><tt class="py-lineno">238</tt>  <tt class="py-line"><tt class="py-docstring">        2. Otherwise, the date the user signed up is incremented by</tt> </tt>
<a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line"><tt class="py-docstring">           the number of days specified in the setting</tt> </tt>
<a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line"><tt class="py-docstring">           ``ACCOUNT_ACTIVATION_DAYS`` (which should be the number of</tt> </tt>
<a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line"><tt class="py-docstring">           days after signup during which a user is allowed to</tt> </tt>
<a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line"><tt class="py-docstring">           activate their account); if the result is less than or</tt> </tt>
<a name="L243"></a><tt class="py-lineno">243</tt>  <tt class="py-line"><tt class="py-docstring">           equal to the current date, the key has expired and this</tt> </tt>
<a name="L244"></a><tt class="py-lineno">244</tt>  <tt class="py-line"><tt class="py-docstring">           method returns ``True``.</tt> </tt>
<a name="L245"></a><tt class="py-lineno">245</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L246"></a><tt class="py-lineno">246</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L247"></a><tt class="py-lineno">247</tt>  <tt class="py-line">        <tt class="py-name">expiration_date</tt> <tt class="py-op">=</tt> <tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">timedelta</tt><tt class="py-op">(</tt><tt class="py-name">days</tt><tt class="py-op">=</tt><tt id="link-62" class="py-name"><a title="digichef.settings
digichef.tagging.settings
digichef.tagging.tests.settings
digichef.voting.tests.settings" class="py-name" href="#" onclick="return doclink('link-62', 'settings', 'link-1');">settings</a></tt><tt class="py-op">.</tt><tt class="py-name">ACCOUNT_ACTIVATION_DAYS</tt><tt class="py-op">)</tt> </tt>
<a name="L248"></a><tt class="py-lineno">248</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-63" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key" class="py-name" href="#" onclick="return doclink('link-63', 'activation_key', 'link-12');">activation_key</a></tt> <tt class="py-op">==</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-64" class="py-name"><a title="digichef.registration.models.RegistrationProfile.ACTIVATED" class="py-name" href="#" onclick="return doclink('link-64', 'ACTIVATED', 'link-24');">ACTIVATED</a></tt> <tt class="py-keyword">or</tt> \ </tt>
<a name="L249"></a><tt class="py-lineno">249</tt>  <tt class="py-line">               <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-65" class="py-name"><a title="digichef.profiles.models.Profile.user
digichef.registration.models.RegistrationProfile.user
digichef.util.models.UserMeta.user
digichef.voting.models.Vote.user" class="py-name" href="#" onclick="return doclink('link-65', 'user', 'link-17');">user</a></tt><tt class="py-op">.</tt><tt class="py-name">date_joined</tt> <tt class="py-op">+</tt> <tt class="py-name">expiration_date</tt> <tt class="py-op">&lt;=</tt> <tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">now</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L250"></a><tt class="py-lineno">250</tt>  <tt class="py-line">    <tt id="link-66" class="py-name"><a title="digichef.registration.models.RegistrationProfile.activation_key_expired" class="py-name" href="#" onclick="return doclink('link-66', 'activation_key_expired', 'link-16');">activation_key_expired</a></tt><tt class="py-op">.</tt><tt class="py-name">boolean</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
</div><a name="L251"></a><tt class="py-lineno">251</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Apr  1 02:28:31 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
